home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / pictb11a / form1.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-05-06  |  7.9 KB  |  278 lines

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    Caption         =   "PictPlus Sample Project (use this as a template)"
  4.    ClientHeight    =   5115
  5.    ClientLeft      =   3345
  6.    ClientTop       =   1500
  7.    ClientWidth     =   6690
  8.    Height          =   5520
  9.    Left            =   3285
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   5115
  12.    ScaleWidth      =   6690
  13.    Top             =   1155
  14.    Width           =   6810
  15.    Begin VB.ComboBox Combo3 
  16.       Height          =   315
  17.       Left            =   4710
  18.       Style           =   2  'Dropdown List
  19.       TabIndex        =   11
  20.       Top             =   2670
  21.       Width           =   1215
  22.    End
  23.    Begin VB.CommandButton Command3 
  24.       Caption         =   "&Open Image"
  25.       Height          =   300
  26.       Left            =   4695
  27.       TabIndex        =   9
  28.       Top             =   810
  29.       Width           =   1230
  30.    End
  31.    Begin VB.CommandButton Command2 
  32.       Caption         =   "&Invert"
  33.       Height          =   315
  34.       Left            =   4725
  35.       TabIndex        =   8
  36.       Top             =   4125
  37.       Width           =   1215
  38.    End
  39.    Begin VB.ComboBox Combo2 
  40.       Height          =   315
  41.       Left            =   4695
  42.       Style           =   2  'Dropdown List
  43.       TabIndex        =   6
  44.       Top             =   3495
  45.       Width           =   1215
  46.    End
  47.    Begin VB.ComboBox Combo1 
  48.       Height          =   315
  49.       Left            =   4695
  50.       Style           =   2  'Dropdown List
  51.       TabIndex        =   4
  52.       Top             =   1860
  53.       Width           =   1215
  54.    End
  55.    Begin VB.HScrollBar HScroll1 
  56.       Height          =   240
  57.       Left            =   825
  58.       TabIndex        =   2
  59.       Top             =   4500
  60.       Width           =   2820
  61.    End
  62.    Begin VB.VScrollBar VScroll1 
  63.       Height          =   2865
  64.       Left            =   4320
  65.       TabIndex        =   1
  66.       Top             =   1260
  67.       Width           =   225
  68.    End
  69.    Begin VB.PictureBox Picture2 
  70.       BackColor       =   &H0000FFFF&
  71.       Height          =   3600
  72.       Left            =   345
  73.       ScaleHeight     =   3540
  74.       ScaleWidth      =   3855
  75.       TabIndex        =   0
  76.       Top             =   810
  77.       Width           =   3915
  78.       Begin VB.PictureBox Picture1 
  79.          BackColor       =   &H00FFFFFF&
  80.          Height          =   1065
  81.          Left            =   120
  82.          ScaleHeight     =   1005
  83.          ScaleWidth      =   990
  84.          TabIndex        =   3
  85.          Top             =   90
  86.          Width           =   1050
  87.       End
  88.    End
  89.    Begin VB.Label Label1 
  90.       Height          =   240
  91.       Left            =   5535
  92.       TabIndex        =   14
  93.       Top             =   4695
  94.       Width           =   630
  95.    End
  96.    Begin VB.Label Label6 
  97.       Caption         =   "Status:"
  98.       Height          =   225
  99.       Left            =   4755
  100.       TabIndex        =   13
  101.       Top             =   4695
  102.       Width           =   660
  103.    End
  104.    Begin VB.Label Label5 
  105.       Height          =   690
  106.       Left            =   45
  107.       TabIndex        =   12
  108.       Top             =   45
  109.       Width           =   6615
  110.    End
  111.    Begin VB.Label Label4 
  112.       Caption         =   "Scale:"
  113.       Height          =   225
  114.       Left            =   4695
  115.       TabIndex        =   10
  116.       Top             =   2430
  117.       Width           =   1095
  118.    End
  119.    Begin MSComDlg.CommonDialog CommonDialog1 
  120.       Left            =   6015
  121.       Top             =   3585
  122.       _ExtentX        =   847
  123.       _ExtentY        =   847
  124.       _Version        =   327681
  125.    End
  126.    Begin VB.Label Label3 
  127.       Caption         =   "Rotation:"
  128.       Height          =   225
  129.       Left            =   4695
  130.       TabIndex        =   7
  131.       Top             =   3255
  132.       Width           =   1185
  133.    End
  134.    Begin VB.Label Label2 
  135.       Caption         =   "Page:"
  136.       Height          =   225
  137.       Left            =   4695
  138.       TabIndex        =   5
  139.       Top             =   1635
  140.       Width           =   1185
  141.    End
  142. Attribute VB_Name = "Form1"
  143. Attribute VB_Creatable = False
  144. Attribute VB_Exposed = False
  145. Dim obj As Object
  146. Dim scaledown, previnvert, stopvar As Integer
  147. Dim vFile, prevFile As String
  148. Dim pPictPlus As PictureBox
  149. Dim ww, hh As Long
  150. Dim oldscale, vScale, rotatevar, prevrotate, prevpage As Single
  151. Function showpicture(ByVal param)
  152. 'call the DisplayPict function
  153. result = obj.DisplayPict(param)
  154. dummy = DoEvents()
  155. 'retrieve the image from the Clipboard.
  156. 'Clipboard is used because of a Microsoft bug in
  157. 'the Picturebox which causes a memory leak.
  158. Picture1.Picture = Clipboard.GetData()
  159. 'specify the scrollbar metrics
  160. HScroll1.Max = Picture1.Width - Picture2.Width + 120
  161. VScroll1.Max = Picture1.Height - Picture2.Height + 120
  162. 'show scrollbars only if the image does not fit into display area.
  163. If Picture1.Width > Picture2.Width Then
  164.      HScroll1.Visible = True
  165.      HScroll1.Visible = False
  166. End If
  167. If Picture1.Height > Picture2.Height Then
  168.      VScroll1.Visible = True
  169.      VScroll1.Visible = False
  170. End If
  171. 'display of return value (probably not needed in your app)
  172. Label1 = result
  173. dummy = DoEvents()
  174. 'create list of page numbers
  175. If Val(result) > 0 Then
  176.     If Combo1.ListCount <> Val(result) Then
  177.         stopvar = 1
  178.         Combo1.Clear
  179.         For i = 1 To Val(result)
  180.             Combo1.AddItem i
  181.         Next
  182.         Combo1.ListIndex = 0
  183.     End If
  184. End If
  185. If Val(result) < 2 Then
  186.     Combo1.Enabled = False
  187.     Combo1.Enabled = True
  188. End If
  189. stopvar = 0
  190. End Function
  191. Private Sub Combo1_Click()
  192. If stopvar = 1 Then
  193.     Exit Sub
  194. End If
  195. param = "pg=" & Combo1 & ",inv=0,rot=0"
  196. dummy = showpicture(param)
  197. End Sub
  198. Private Sub Combo2_Click()
  199. If stopvar = 1 Then
  200.     Exit Sub
  201. End If
  202. param = "rot=" & Combo2
  203. dummy = showpicture(param)
  204. End Sub
  205. Private Sub Combo3_Click()
  206. If stopvar = 1 Then
  207.     Exit Sub
  208. End If
  209. param = "scale=" & Val(Combo3)
  210. dummy = showpicture(param)
  211. End Sub
  212. Private Sub Command2_Click()
  213. param = "inv=1"
  214. dummy = showpicture(param)
  215. End Sub
  216. Private Sub Command3_Click()
  217. CommonDialog1.Action = 1
  218. param = "file=" & CommonDialog1.filename & ",rot=0,inv=0,error=1"
  219. dummy = showpicture(param)
  220. Combo2.ListIndex = 0
  221. End Sub
  222. Private Sub Form_Load()
  223. 'create the PictPlus object
  224. Set obj = CreateObject("PictPlus.ClsPictPlus")
  225. 'adjust size and position of display PictureBox
  226. Picture1.BorderStyle = 0
  227. Picture1.Width = Picture2.Width
  228. Picture1.Height = Picture2.Height
  229. Picture1.Left = 0
  230. Picture1.Top = 0
  231. 'adjust size and position of scroll bars
  232. VScroll1.Height = Picture2.Height
  233. VScroll1.Top = Picture2.Top
  234. VScroll1.Left = Picture2.Left + Picture2.Width
  235. HScroll1.Width = Picture2.Width
  236. HScroll1.Left = Picture2.Left
  237. HScroll1.Top = Picture2.Top + Picture2.Height
  238. 'specify the metric for the scroll bars
  239. HScroll1.SmallChange = Picture2.Width \ 10
  240. VScroll1.SmallChange = Picture2.Height \ 10
  241. HScroll1.LargeChange = Picture2.Width * 0.75
  242. VScroll1.LargeChange = Picture2.Height * 0.75
  243. 'set Picture1 properties
  244. Picture1.AutoRedraw = True
  245. Picture1.AutoSize = True
  246. 'remove yellow background color for better cosmetics
  247. Picture2.BackColor = RGB(255, 255, 255)
  248. 'set the Combobox values.  Sopvar is neede to prevent looping
  249. stopvar = 1
  250. Combo2.AddItem "0"
  251. Combo2.AddItem "90"
  252. Combo2.AddItem "180"
  253. Combo2.AddItem "270"
  254. Combo2.ListIndex = 0
  255. stopvar = 0
  256. stopvar = 1
  257. Combo3.AddItem "auto"
  258. Combo3.AddItem "25"
  259. Combo3.AddItem "33"
  260. Combo3.AddItem "50"
  261. Combo3.AddItem "75"
  262. Combo3.AddItem "100"
  263. Combo3.AddItem "150"
  264. Combo3.AddItem "200"
  265. Combo3.ListIndex = 0
  266. stopvar = 0
  267. End Sub
  268. Private Sub Form_Unload(Cancel As Integer)
  269. 'release of object.
  270. Set obj = Nothing
  271. End Sub
  272. Private Sub HScroll1_Change()
  273. Picture1.Left = 0 - HScroll1
  274. End Sub
  275. Private Sub VScroll1_Change()
  276. Picture1.Top = 0 - VScroll1
  277. End Sub
  278.